using System;

namespace PropertyExpression.ReactiveRelation
{
    public static class BinderExtensions
    {
        public static Func<FuncCache, TCalcContext, Func<T, TResult>>
            CacheFunc<TCalcContext, TEntity, T, TResult>(
            this IBinder<TCalcContext, TEntity> binder,
            Func<TCalcContext, TypeInferencer, Func<T, TResult>> func)
        {
            return CachedFuncRegistrator.CacheFunc(func);
        }

        public static Func<FuncCache, TCalcContext, Func<T1, T2, TResult>>
            CacheFunc<TCalcContext, TEntity, T1, T2, TResult>(
            this IBinder<TCalcContext, TEntity> binder,
            Func<TCalcContext, TypeInferencer, Func<T1, T2, TResult>> func)
        {
            return CachedFuncRegistrator.CacheFunc(func);
        }

        public static Func<FuncCache, TCalcContext, Func<T1, T2, T3, TResult>>
            CacheFunc<TCalcContext, TEntity, T1, T2, T3, TResult>(
            this IBinder<TCalcContext, TEntity> binder,
            Func<TCalcContext, TypeInferencer, Func<T1, T2, T3, TResult>> func)
        {
            return CachedFuncRegistrator.CacheFunc(func);
        }

        public static Func<FuncCache, TCalcContext, Func<T1, T2, T3, T4, TResult>>
            CacheFunc<TCalcContext, TEntity, T1, T2, T3, T4, TResult>(
            this IBinder<TCalcContext, TEntity> binder,
            Func<TCalcContext, TypeInferencer, Func<T1, T2, T3, T4, TResult>> func)
        {
            return CachedFuncRegistrator.CacheFunc(func);
        }

        public static Func<FuncCache, TCalcContext, Func<T, TResult>>
            CacheFuncWithArgument<TCalcContext, TEntity, T, TResult>(
            this IBinder<TCalcContext, TEntity> binder,
            Func<TCalcContext, TypeInferencer, Func<T, TResult>> func)
            where T : ICachedFuncArgument
        {
            return CachedFuncRegistrator.CacheFuncWithArgument(func);
        }

        public static Func<FuncCache, TEntity, Func<TResult>>
            CacheEntityFunc<TCalcContext, TEntity, TResult>(
            this IBinder<TCalcContext, TEntity> binder,
            Func<TEntity, TypeInferencer, Func<TResult>> func)
        {
            return CachedFuncRegistrator.CacheEntityFunc(func);
        }

        public static Func<FuncCache, TEntity, Func<T, TResult>>
            CacheEntityFunc<TCalcContext, TEntity, T, TResult>(
            this IBinder<TCalcContext, TEntity> binder,
            Func<TEntity, TypeInferencer, Func<T, TResult>> func)
        {
            return CachedFuncRegistrator.CacheEntityFunc(func);
        }

        public static Func<FuncCache, TEntity, Func<T1, T2, TResult>>
            CacheEntityFunc<TCalcContext, TEntity, T1, T2, TResult>(
            this IBinder<TCalcContext, TEntity> binder,
            Func<TEntity, TypeInferencer, Func<T1, T2, TResult>> func)
        {
            return CachedFuncRegistrator.CacheEntityFunc(func);
        }

        public static Func<FuncCache, TEntity, Func<T1, T2, T3, TResult>>
            CacheEntityFunc<TCalcContext, TEntity, T1, T2, T3, TResult>(
            this IBinder<TCalcContext, TEntity> binder,
            Func<TEntity, TypeInferencer, Func<T1, T2, T3, TResult>> func)
        {
            return CachedFuncRegistrator.CacheEntityFunc(func);
        }

        public static Func<FuncCache, TEntity, Func<T1, T2, T3, T4, TResult>>
            CacheEntityFunc<TCalcContext, TEntity, T1, T2, T3, T4, TResult>(
            this IBinder<TCalcContext, TEntity> binder,
            Func<TEntity, TypeInferencer, Func<T1, T2, T3, T4, TResult>> func)
        {
            return CachedFuncRegistrator.CacheEntityFunc(func);
        }

        public static Func<FuncCache, TEntity, Func<T, TResult>>
            CacheEntityFuncWithArgument<TCalcContext, TEntity, T, TResult>(
            this IBinder<TCalcContext, TEntity> binder,
            Func<TEntity, TypeInferencer, Func<T, TResult>> func)
            where T : ICachedFuncArgument
        {
            return CachedFuncRegistrator.CacheEntityFuncWithArgument(func);
        }

        public static Func<FuncCache, TCalcContext, TEntity, Func<T, TResult>>
            CacheEntityFunc<TCalcContext, TEntity, T, TResult>(
            this IBinder<TCalcContext, TEntity> binder,
            Func<TCalcContext, TEntity, TypeInferencer, Func<T, TResult>> func)
        {
            return CachedFuncRegistrator.CacheEntityFunc(func);
        }

        public static Func<FuncCache, TCalcContext, TEntity, Func<T1, T2, TResult>>
            CacheEntityFunc<TCalcContext, TEntity, T1, T2, TResult>(
            this IBinder<TCalcContext, TEntity> binder,
            Func<TCalcContext, TEntity, TypeInferencer, Func<T1, T2, TResult>> func)
        {
            return CachedFuncRegistrator.CacheEntityFunc(func);
        }

        public static Func<FuncCache, TCalcContext, TEntity, Func<T1, T2, T3, TResult>>
            CacheEntityFunc<TCalcContext, TEntity, T1, T2, T3, TResult>(
            this IBinder<TCalcContext, TEntity> binder,
            Func<TCalcContext, TEntity, TypeInferencer, Func<T1, T2, T3, TResult>> func)
        {
            return CachedFuncRegistrator.CacheEntityFunc(func);
        }

        public static Func<FuncCache, TCalcContext, TEntity, Func<T1, T2, T3, T4, TResult>>
            CacheEntityFunc<TCalcContext, TEntity, T1, T2, T3, T4, TResult>(
            this IBinder<TCalcContext, TEntity> binder,
            Func<TCalcContext, TEntity, TypeInferencer, Func<T1, T2, T3, T4, TResult>> func)
        {
            return CachedFuncRegistrator.CacheEntityFunc(func);
        }

        public static Func<FuncCache, TCalcContext, TEntity, Func<T, TResult>>
            CacheEntityFuncWithArgument<TCalcContext, TEntity, T, TResult>(
            this IBinder<TCalcContext, TEntity> binder,
            Func<TCalcContext, TEntity, TypeInferencer, Func<T, TResult>> func)
            where T : ICachedFuncArgument
        {
            return CachedFuncRegistrator.CacheEntityFuncWithArgument(func);
        }
    }
}